import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 高生平
 * Date: 2025-09-02
 * Time: 16:27
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        int max = num1 > num2 ? num1 : num2;
        int min = num1 < num2 ? num1 : num2;
        int tmp = 0;
        while(min != 0) {
            tmp = max % min;
            max = min;
            min = tmp;
        }
        System.out.println(num1 + "和" + num2 + "的最大公约数为" + max);
    }
}
